#!/usr/bin/python

class ExceptionUserInfoMiddleware(object):
    def process_exception(self, request, exception):
        try:
            if request.user.is_authenticated():
                request.META['USER_EMAIL'] = request.user.email
                request.META['CURRENT_USER'] = request.user.username
            else:
                request.META['USER_EMAIL'] = "UNKNOWN"
                request.META['CURRENT_USER'] = "UNKNOWN"
        except:
            request.META['USER_EMAIL'] = "UNKNOWN"
            request.META['CURRENT_USER'] = "UNKNOWN"
            pass


